package lab01;

/**
 * Created by Administrator on 2017/9/30.
 */
public class Test05 {
    public static void main(String[] args) {
        do_while();
        while_();
        for_add();
    }

    static void do_while() {
        int sum = 0;
        int i = 1;
        do {
            sum = sum + i;
            i++;
        }
        while (i <= 1000);
        System.out.println(sum);
    }

    static void while_() {
        int sum = 0;
        int i = 1;
        while (i <= 1000) {
            sum = sum + i;
            i++;
        }
        System.out.println(sum);
    }

    static void for_add() {
        int sum = 0;
        for (int i = 1; i <= 1000; i++) {
            sum = sum + i;
        }
        System.out.println(sum);
    }
}
